package com.ruyuan.eshop.common.model.promotion.tool.vo;


import com.fasterxml.jackson.databind.PropertyNamingStrategy;
import com.fasterxml.jackson.databind.annotation.JsonNaming;
import io.swagger.annotations.ApiModelProperty;
import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder;

import java.io.Serializable;

/**
 * 活动商品对照表
 *
 * @author pwd
 * @version 1.0
 */
@JsonNaming(value = PropertyNamingStrategy.SnakeCaseStrategy.class)
public class PromotionVO implements Serializable {

	/**
	 *
	 */
	private static final long serialVersionUID = 4796645552318671313L;

	@ApiModelProperty(value = "商品id")
	private Long goodsId;

	@ApiModelProperty(value = "商品图片")
	private String thumbnail;

	@ApiModelProperty(value = "商品名称")
	private String name;

	@ApiModelProperty(value = "货品id")
	private Long skuId;

	@ApiModelProperty(value = "活动开始时间")
	private Long startTime;

	@ApiModelProperty(value = "活动结束时间")
	private Long endTime;

	@ApiModelProperty(value = "活动id")
	private Long activityId;

	/**
	 * 由此字段识别具体的活动类型
	 * 此字段对应的是一个枚举值
	 *
	 */
	@ApiModelProperty(value = "活动工具类型")
	private String promotionType;

	@ApiModelProperty(value = "活动名称")
	private String title;


	@ApiModelProperty(value = "售空数量")
	private Integer num;

	@ApiModelProperty(value = "活动价格")
	private Double price;

	public PromotionVO() {}

	public Long getGoodsId() {
		return goodsId;
	}

	public void setGoodsId(Long goodsId) {
		this.goodsId = goodsId;
	}

	public String getThumbnail() {
		return thumbnail;
	}

	public void setThumbnail(String thumbnail) {
		this.thumbnail = thumbnail;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public Long getSkuId() {
		return skuId;
	}

	public void setSkuId(Long skuId) {
		this.skuId = skuId;
	}

	public Long getStartTime() {
		return startTime;
	}

	public void setStartTime(Long startTime) {
		this.startTime = startTime;
	}

	public Long getEndTime() {
		return endTime;
	}

	public void setEndTime(Long endTime) {
		this.endTime = endTime;
	}

	public Long getActivityId() {
		return activityId;
	}

	public void setActivityId(Long activityId) {
		this.activityId = activityId;
	}

	public String getPromotionType() {
		return promotionType;
	}

	public void setPromotionType(String promotionType) {
		this.promotionType = promotionType;
	}

	public String getTitle() {
		return title;
	}

	public void setTitle(String title) {
		this.title = title;
	}




	public Integer getNum() {
		return num;
	}

	public void setNum(Integer num) {
		this.num = num;
	}

	public Double getPrice() {
		return price;
	}

	public void setPrice(Double price) {
		this.price = price;
	}

	@Override
	public boolean equals(Object o) {
		if (this == o){
			return true;
		}

		if (o == null || getClass() != o.getClass()){
			return false;
		}

		PromotionVO that = (PromotionVO) o;

		return new EqualsBuilder()
				.append(goodsId, that.goodsId)
				.append(thumbnail, that.thumbnail)
				.append(name, that.name)
				.append(skuId, that.skuId)
				.append(startTime, that.startTime)
				.append(endTime, that.endTime)
				.append(activityId, that.activityId)
				.append(promotionType, that.promotionType)
				.append(title, that.title)
				.append(num, that.num)
				.append(price, that.price)
				.isEquals();
	}

	@Override
	public int hashCode() {
		return new HashCodeBuilder(17, 37)
				.append(goodsId)
				.append(thumbnail)
				.append(name)
				.append(skuId)
				.append(startTime)
				.append(endTime)
				.append(activityId)
				.append(promotionType)
				.append(title)
				.append(num)
				.append(price)
				.toHashCode();
	}

	@Override
	public String toString() {
		return "PromotionVO{" +
				"goodsId=" + goodsId +
				", thumbnail='" + thumbnail + '\'' +
				", name='" + name + '\'' +
				", skuId=" + skuId +
				", startTime=" + startTime +
				", endTime=" + endTime +
				", activityId=" + activityId +
				", promotionType='" + promotionType + '\'' +
				", title='" + title + '\'' +
				", num=" + num +
				", price=" + price +
				'}';
	}
}
